package com.example.fms.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.fms.dto.req.ActivityReq;
import com.example.fms.dto.req.ActivityUserReq;
import com.example.fms.dto.resp.ActivityResp;
import com.example.fms.dto.resp.ActivityUserResp;
import com.example.fms.service.ActivityUserService;
import com.example.fms.vo.ResponseBean;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Validated
@RestController
@RequestMapping("/activityUser")
public class ActivityUserController {

    @Resource
    ActivityUserService activityUserService;
    /**
     * 参加活动
     * @param req 参加活动
     * @return 结果
     */
    @PostMapping("/save")
    public ResponseBean<Boolean> attend(@RequestBody ActivityUserReq req) {
        return ResponseBean.success(activityUserService.attend(req));
    }

    /**
     * 参加活动
     * @param req 参加活动
     * @return 结果
     */
    @PostMapping("/list")
    public ResponseBean<List<ActivityUserResp>> List(@RequestBody ActivityUserReq req) {
        return ResponseBean.success(activityUserService.List(req));
    }

    /**
     * 退出
     * @param req
     * @return 结果
     */
    @PostMapping("/exit")
    public ResponseBean<Boolean> exit(@RequestBody ActivityUserReq req) {
        return ResponseBean.success(activityUserService.exit(req));
    }

}
